package com.example.wsh.worddemo.Word_Fragment;

import android.content.Intent;
import android.database.Cursor;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

import com.example.wsh.worddemo.DatabaseFile.CursorGetAll;
import com.example.wsh.worddemo.R;
import com.jaeger.library.StatusBarUtil;

import mehdi.sakout.fancybuttons.FancyButton;

public class DoneAllWords extends AppCompatActivity {

    private ListView All_Done_Words;
    private FancyButton go_to_search;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_done_all_words);
        StatusBarUtil.setTranslucent(DoneAllWords.this);
        ActionBar actionBar  = getSupportActionBar();
        if(actionBar != null){
            actionBar.hide();
        }

        go_to_search = findViewById(R.id.go_to_search);

        Cursor cursor = CursorGetAll.limitexecute("AllDone");
        SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(DoneAllWords.this,R.layout.item_for_all_done,cursor, new String[]{"name"},new int[]{R.id.name},SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
        try{
            All_Done_Words = findViewById(R.id.All_Done_Words);
        }catch (Exception e){
            Log.d("WSHH",e.toString());
        }
        try {
            All_Done_Words.setAdapter(cursorAdapter);
        }catch (Exception e){
            Log.d("WSHH",e.toString());
        }

        go_to_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(DoneAllWords.this,Inquiry.class);
                startActivity(intent);
            }
        });
    }
}
